<template>
  <div id="app">
    <el-container>
      <el-header>
        <el-menu
          :default-active="activeIndex"
          mode="horizontal"
          @select="handleSelect"
          background-color="#545c64"
          text-color="#fff"
          active-text-color="#ffd04b"
          router>
          <el-menu-item index="/">
            <Logo class="logo" />
          </el-menu-item>
          <el-menu-item index="/">首页</el-menu-item>
          <el-menu-item index="/portfolio">作品展示</el-menu-item>
          <el-menu-item index="/about">关于公司</el-menu-item>
          <el-menu-item index="/news">热门资讯</el-menu-item>
          <el-menu-item index="/jobs">热门招聘</el-menu-item>
          <el-menu-item index="/workTree">作品树</el-menu-item>
        </el-menu>
      </el-header>
      
      <el-main>
        <router-view></router-view>
      </el-main>

      <el-footer height="60px">
        <p>© 2024 公司名称 版权所有</p>
      </el-footer>
    </el-container>
  </div>
</template>

<script>
import Logo from './components/Logo.vue'

export default {
  name: 'App',
  components: {
    Logo
  },
  data() {
    return {
      activeIndex: '/'
    }
  },
  methods: {
    handleSelect(key) {
      this.activeIndex = key
    }
  },
  created() {
    // 根据当前路由设置激活菜单
    this.activeIndex = this.$route.path
  }
}
</script>

<style>
/* 全局样式 */
body {
  margin: 0;
  padding: 0;
  font-family: "Helvetica Neue", Helvetica, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "微软雅黑", Arial, sans-serif;
}

#app {
  height: 100vh;
}

.el-container {
  height: 100%;
  overflow-x: hidden;
}

.el-header {
  padding: 0;
  position: fixed;
  width: 100%;
  z-index: 999;
}

.el-main {
  padding-top: 60px;
  min-height: calc(100vh - 120px);
  background-color: #f5f5f5;
  overflow-x: hidden;
}

.el-footer {
  text-align: center;
  background-color: #545c64;
  color: #fff;
  line-height: 60px;
}

.logo {
  margin: 5px 15px;
  display: inline-block;
  background: white;
  padding: 5px 10px;
  border-radius: 4px;
  box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
}

/* 响应式调整 */
@media screen and (max-width: 768px) {
  .el-menu-item {
    padding: 0 10px;
  }
  
  .logo {
    height: 30px;
  }
}

/* 自定义滚动条样式 */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb {
  background: #909399;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: #606266;
}

.nav-link {
  margin: 0 10px;
  text-decoration: none;
  color: #333;
}

.nav-link:hover {
  color: #666;
}
</style>
